package concurrency.chapter1;
//模板方法
public class TemplateMethod {
    //该方法要定义为final，不能被复写
    public final void print(String message){
        System.out.println("########");
        wrapPrint(message);
        System.out.println("########");
    }
    protected void wrapPrint(String message){

    }

    public static void main(String[] args) {
        TemplateMethod t1 = new TemplateMethod(){
            @Override
            protected void wrapPrint(String message) {
                System.out.println("*"+message+"*");
            }
        };
        t1.print("Hello");
    }
}
